package com.dreamcode.anfeedreader.activity;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.ListView;
import android.widget.AdapterView.OnItemClickListener;

import com.dreamcode.anfeedreader.collectors.FeedsDAOimpl;
import com.dreamcode.anfeedreader.collectors.MarkedFeedListAdapter;

public class RelevantFeedItems extends Activity{

	private Button btnFeeds = null;
	private Button btnItems = null;
	private FeedsDAOimpl feedsDAO = null;
	private ListView feedItemList = null;
	private Button btnUpdate = null;
	private Button btnSettings = null;
	private Button btnNew = null;
	private Button btnAbout = null;
	private Button btnSearchItem = null;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.relevantitems);
    initView();
  }

  private void initView() {
    feedsDAO = FeedsDAOimpl.getInstance();
    feedItemList = (ListView) findViewById(R.id.marked_itemlist);          
    feedItemList.setAdapter(new MarkedFeedListAdapter(RelevantFeedItems.this,
    feedsDAO.getAllMarkedFeedItemsFromDB(RelevantFeedItems.this)));
    feedItemList.setOnItemClickListener(new OnItemClickListener() {
      
        @Override
        public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {                    
          Intent i = new Intent(RelevantFeedItems.this,FeedItemViewActivity.class);
          i.putExtra("id", arg1.getId());
          startActivity(i);
          }
        });
    btnUpdate = (Button) findViewById(R.id.btnupdate);
    btnUpdate.setEnabled(false);
    btnNew = (Button) findViewById(R.id.btnnew);
    btnNew.setEnabled(false);
    btnAbout = (Button) findViewById(R.id.btnabout);
	btnAbout.setOnClickListener(new OnClickListener() {
		
		@Override
		public void onClick(View v) {
			AlertDialog groupDialog = new AlertDialog.Builder(RelevantFeedItems.this).setTitle("AnFeedReader")
			.setMessage("Version : 0.1\nDevelopment:\nZarko Popovski\nLazar Pancevski")
			.setPositiveButton("OK", null).show();		
			
		}
	});
    
    
  }

}
